package tree.treerecursion;

import tree.TreeNode;

/**
 * @Classname : InvertBinaryTree
 * @Description :
 * <a href="https://leetcode.cn/problems/invert-binary-tree/">226. 翻转二叉树</a>
 * @Author : chentianyu
 * @Date 2023/1/20 09:11
 */


public class InvertBinaryTree {
    public TreeNode invertTree(TreeNode root) {
        if (root == null) return null;

        TreeNode tmp = root.left;
        root.left = invertTree(root.right);
        root.right = invertTree(tmp);
        return root;
    }
}
